/*mulfunc.c*/
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>

void clean_1(void *arg){
    printf("%s\n", (char *)arg);
}

void *t1_execute(void *arg){
    pthread_cleanup_push(clean_1,"thread first handler");
    pthread_cleanup_push(clean_1,"thread second handler");
    if ( *(int*)arg==1 ) pthread_exit(NULL);
    else exit(0);
    pthread_cleanup_pop(0);
    pthread_cleanup_pop(0);
}

void main(){
    pthread_t pid1;
    int error1;
    int i=1;
    error1=pthread_create(&pid1,NULL, t1_execute,(void *)&i);
    if(error1!=0) {
        printf("pthread_create failed ");
        return ;
    }
    pthread_join(pid1,NULL);
    return ;
}

